package com.chihb.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author chihb
 * @create-time 2024/11/28 14:21
 * @description
 */
@RestController
@RequestMapping("/test")
public class testController {


    @GetMapping("/hello")
    @PreAuthorize("hasAuthority('system:test:list')")  //如果当前登录的用户拥有test权限，则可以访问该接口
    public String hello(){
        System.out.println("=============hello======================");
        return "hello";
    }


    @GetMapping("/add")
    @PreAuthorize("hasAuthority('ceo')")
    public String add(){
        System.out.println("=============hello======================");
        return "hello";
    }

    @GetMapping("/select")
    public String select(){
        System.out.println("=============hello======================");
        return "hello";
    }

    @GetMapping("/update")
    public String update(){
        System.out.println("=============hello======================");
        return "update";
    }
}
